Skip to content

1.4. Providers

In one glance

  • You will: Configure a model provider and verify the settings without sending a prompt.
  • You need: The Python runtime from install:learner; credentials only for the hosted model path.
  • Time: about 15 minutes, hands-on.

For offline practice, skip provider setup and use How do you continue without either provider?. You need no .env, API key, local model, or running service.

How do you configure Gemini?

Create a Gemini API key in Google AI Studio, then save it in the repository-root .env.

From the repository root, copy the example only if .env does not already exist:

test -e .env || cp .env.example .env
chmod 600 .env

Edit GOOGLE_API_KEY in .env with your editor. The example selects AGENT_MODEL_PROVIDER=gemini and the course's compatibility-pinned model. Do not put the key in a command, screenshot, notebook output, or Git commit.

mise run config:check

Expected: the command reports valid configuration and masks the key. It does not call a model or verify your account's quota. A missing key fails with the variable name and recovery instructions.

What does hosted access mean for a free course?

Gemini runs outside your laptop and receives the prompt and tool results used for inference.

Use the fictional course data. Review the current pricing and API terms before sending your own data. Model access, free quotas, and regional availability can change.

Hosted model calls can be billed

The course is free to read and reuse. A billing-enabled Gemini project can charge for calls. Free-tier quota is not guaranteed for every learner or model. Repeated evaluations and retries make additional calls.

A 429 response means you should inspect the project's quota and wait or reduce calls. Do not automatically enable billing or switch models. Run offline checks while access is unavailable. Refer to rate limits for the current rules.

How do you use Ollama as Plan B?

Ollama is an optional local model path for a machine with enough memory and disk.

Install Ollama, start its server, and pull the model:

ollama pull qwen3:4b-instruct

Replace the provider block in .env:

AGENT_MODEL_PROVIDER=openai-compatible
AGENT_MODEL=qwen3:4b-instruct
OPENAI_BASE_URL=http://127.0.0.1:11434/v1
OPENAI_API_KEY=local-ollama

The marker is non-secret; the SDK requires a non-empty value. Local inference uses your hardware and electricity. It can be slow on CPU, so do not use its latency as a promised Gemini baseline.

For the optional local model diagnostic, install the contributor tools with mise run install, then run mise run doctor:model. mise run config:check works with the small learner installation.

How do you continue without either provider?

All workshop checks and worked solutions run without inference.

mise run check:labs

This command validates the worked solutions without creating learner files. After starting an exercise, use mise run lab -- check N to check your own code. Later, the evaluation lab uses labeled recorded answers, including missing and invented incident IDs. These are explicit offline exercises, not a substitute for measuring the configured live model.

Which settings change at the platform handoff?

The developer path calls Gemini through ADK's native client; the platform path uses the gateway's OpenAI-compatible endpoint.

Part II changes AGENT_MODEL_PROVIDER, OPENAI_BASE_URL, and the caller marker. The provider key moves to agentgateway. The application code and model name stay the same, but the transport changes and must be evaluated again.

Owned by 5.4. Model Gateway.

How do you prepare the optional enterprise path?

Use ADC only when you deliberately choose the optional Google Cloud extension.

Set GOOGLE_CLOUD_PROJECT=your-gcp-project-id with the enterprise/location variables from .env.example, and remove the API key. Run GCP_PROJECT_ID=your-gcp-project-id mise run doctor:gcp after installing the cloud tier. The doctor does not load GOOGLE_CLOUD_PROJECT from .env; its project selection is explicit and separate.

What proves this page worked?

For a configured provider, run:

mise run config:check

For offline practice, run mise run check:labs instead. Provider validation is unnecessary until you choose to make model calls.

You are done when:

  • You either chose offline practice or validated the provider and model for interactive work.
  • If you configured credentials, secrets are masked and .env is excluded from Git.
  • You understand whether the next command is offline, sends data to Gemini, or uses local inference.
  • You have made no model call merely to validate configuration.

Continue to 2.1. First Agent when your chosen path passes its check.